public class Test3_1 {
    public static void main(String[] args) {
        StringBuilder result = new StringBuilder();

        for (int i = 1; i <= 9999; i++) {
            if (isArmstrongNumber(i)) {
   //新的            
                if (result.length() > 0) {
                    result.append(",");
                }
                result.append(i);
            }
        }
    
        System.out.println(result.toString());
    }


    private static boolean isArmstrongNumber(int number) {
   
        if (number < 10) {
            return true;
        }

        int originalNumber = number;
        int digits = String.valueOf(number).length(); 
        int sum = 0;

 
        while (number > 0) {
            int digit = number % 10; 
            sum += (int) Math.pow(digit, digits); 
            number /= 10; 
        }

        return sum == originalNumber;
    }
}
